home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / speed-text.scm < prev    next >
Encoding:
Text File  |  2009-08-19  |  3.4 KB  |  101 lines

  1. ; Speed text
  2. ; Copyright (c) 1998 Austin Donnelly <austin@greenend.org.uk>
  3. ;
  4. ;
  5. ; Based on alien glow code from Adrian Likins
  6. ;
  7. ; This program is free software: you can redistribute it and/or modify
  8. ; it under the terms of the GNU General Public License as published by
  9. ; the Free Software Foundation; either version 3 of the License, or
  10. ; (at your option) any later version.
  11. ;
  12. ; This program is distributed in the hope that it will be useful,
  13. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ; GNU General Public License for more details.
  16. ;
  17. ; You should have received a copy of the GNU General Public License
  18. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19.  
  20.  
  21. (define (script-fu-speed-text string font font-size density text-color bg-color)
  22.   (let* (
  23.         (text-ext (gimp-text-get-extents-fontname string font-size PIXELS font))
  24.         (wid (+ (car text-ext) 20))
  25.         (hi  (+ (list-ref text-ext 1) 20))
  26.         (img (car (gimp-image-new wid hi RGB)))
  27.         (bg-layer (car (gimp-layer-new img wid hi  RGB-IMAGE "Background" 100 NORMAL-MODE)))
  28.         (text-layer (car (gimp-layer-new img wid hi  RGBA-IMAGE "Text layer" 100 NORMAL-MODE)))
  29.         (text-mask 0)
  30.         (saved-select 0)
  31.         (cell-size (/ font-size 8))
  32.         (grey (/ (* density 255) 100))
  33.         (saved-sel 0)
  34.         (text-mask 0)
  35.         )
  36.  
  37.     (gimp-context-push)
  38.  
  39.     (gimp-image-undo-disable img)
  40.     (gimp-image-add-layer img bg-layer 1)
  41.     (gimp-image-add-layer img text-layer -1)
  42.  
  43.     (gimp-context-set-background bg-color)
  44.     (gimp-edit-clear bg-layer)
  45.     (gimp-edit-clear text-layer)
  46.  
  47.     (gimp-floating-sel-anchor (car (gimp-text-fontname img text-layer 10 10 string 0 TRUE font-size PIXELS font)))
  48.  
  49.     ; save the selection for later
  50.     (gimp-selection-layer-alpha text-layer)
  51.     (set! saved-sel (car (gimp-selection-save img)))
  52.  
  53.     ; add layer mask
  54.     (set! text-mask (car (gimp-layer-create-mask text-layer ADD-ALPHA-MASK)))
  55.     (gimp-layer-add-mask text-layer text-mask)
  56.  
  57.     ; grow the layer
  58.     (gimp-layer-set-edit-mask text-layer FALSE)
  59.     (gimp-selection-grow img 10)
  60.     (gimp-context-set-foreground text-color)
  61.     (gimp-edit-fill text-layer FOREGROUND-FILL)
  62.  
  63.     ; feather the mask
  64.     (gimp-layer-set-edit-mask text-layer TRUE)
  65.     (gimp-selection-load saved-sel)
  66.     (gimp-selection-feather img 10)
  67.     (gimp-context-set-background (list grey grey grey))
  68.     (gimp-edit-fill text-mask BACKGROUND-FILL)
  69.     (gimp-edit-fill text-mask BACKGROUND-FILL)
  70.     (gimp-edit-fill text-mask BACKGROUND-FILL)
  71.     (gimp-selection-none img)
  72.  
  73.     (plug-in-newsprint RUN-NONINTERACTIVE img text-mask cell-size 0 0 0.0 1 45.0 0 45.0 0 45.0 0 5)
  74.  
  75.     (gimp-layer-remove-mask text-layer MASK-APPLY)
  76.  
  77.     (gimp-image-undo-enable img)
  78.     (gimp-display-new img)
  79.  
  80.     (gimp-context-pop)
  81.   )
  82. )
  83.  
  84. (script-fu-register "script-fu-speed-text"
  85.   _"Speed Text..."
  86.   _"Create a logo with a speedy text effect"
  87.   "Austin Donnelly"
  88.   "Austin Donnelly"
  89.   "1998"
  90.   ""
  91.   SF-STRING     _"Text"               "Speed!"
  92.   SF-FONT       _"Font"               "Charter"
  93.   SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
  94.   SF-ADJUSTMENT _"Density (%)"        '(80 0 100 1 10 0 0)
  95.   SF-COLOR      _"Text color"         "black"
  96.   SF-COLOR      _"Background color"   "white"
  97. )
  98.  
  99. (script-fu-menu-register "script-fu-speed-text"
  100.                          "<Image>/File/Create/Logos")
  101.